/**
 * 
 */
package neptune.web.server.operations;

import it.robertobifulco.ias.IncorrectParamsException;
import it.robertobifulco.ias.Operation;
import neptune.manager.configurator.ConfiguratorException;
import neptune.web.client.services.experiment.TopologyConfigurationException;
import neptune.web.server.ApplicationManager;
import neptune.web.server.Debug;

/**
 * @author Roberto Bifulco [info@robertobifulco.it, robertobifulco.it]
 * 
 */
public class TopologyConfiguration implements Operation {

	public static String ID = "TopologyConfiguration";

	/**
	 * 
	 * 
	 * @param String
	 *            args[0] filePath del documento xml che contiene la descrizione
	 *            della topologia
	 */
	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#execute(java.lang.Object[])
	 */
	public Object[] execute(Object[] args) throws IncorrectParamsException,
			Exception {

		String expId = (String) args[0];
		try {
			ApplicationManager.getApplicationManager().getNeptuneManager()
					.configureExperiment(expId);
		} catch (ConfiguratorException e) {
			Debug.printTrace(e);
			throw new TopologyConfigurationException(e.getMessage());
		}

		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getDescription()
	 */
	public String getDescription() {
		return "Topology configuration operation";
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getID()
	 */
	public String getID() {
		return ID;
	}

}
